<%@page import="br.unirio.pf.service.Imovel"%>
<%@page import="java.util.List"%>
<%@include file="../_header.jsp"%>

<h1>Dados dos im&oacute;veis</h1>

<%=request.getAttribute("mensagem")%>
<%if((request.getAttribute("mensagem").toString().compareTo("Nenhum im&oacute;vel encontrado!"))!=0){%>

<form>
    <table border="2" style="text-align:center" align="center">  
        
        <tr>
            <th>Imobili&aacute;ria</th>
            <th>Pre&ccedil;o</th>
            <th>&Aacute;rea</th>
            <th>N&uacute;mero de quartos</th>
            <th>Possui vaga de garagem</th>
            <th>Hor&aacute;rio do sol</th>
            <th>Logradouro</th>
            <th>N&uacute;mero</th>
            <th>Complemento</th>
            <th>Bairro</th>
            <th>Cidade</th>
            <th>Estado</th>
            <th>Op&ccedil;&otilde;es</th>
	</tr>
        
        <tr>
            <%List imoveis = (List)request.getAttribute("listaCompleta");
                    for(int i=0;i<imoveis.size();i++){
                    %>
                        <td><%=((Imovel)imoveis.get(i)).getImbNome()%></td>
                        <td><%=((Imovel)imoveis.get(i)).getImvPreco()%></td>
                        <td><%=((Imovel)imoveis.get(i)).getImvArea()%></td>
                        <td><%=((Imovel)imoveis.get(i)).getImvNumQuartos()%></td>
                        <td><%if(!((Imovel)imoveis.get(i)).isImvPosVagGaragem()) out.print("N&atilde;o"); else out.print("Sim");%></td>
                        <td><%=((Imovel)imoveis.get(i)).getImvHorSol()%></td>
                        <td><%=((Imovel)imoveis.get(i)).getImvLogradouro()%></td>
                        <td><%=((Imovel)imoveis.get(i)).getImvNumero()%></td>
                        <td><%=((Imovel)imoveis.get(i)).getImvComplemento()%></td>
                        <td><%=((Imovel)imoveis.get(i)).getImvBairro()%></td>
                        <td><%=((Imovel)imoveis.get(i)).getImvCidade()%></td>
                        <td><%=((Imovel)imoveis.get(i)).getImvEstado()%></td>
                        <td>
                            <input type="button" onclick="javascript: location.href='ImovelServlet?comando=detalharImovel&index=<%=i%>';" value="Detalhes" />
                            <input type="button" onclick="javascript: location.href='ImovelServlet?comando=antesSubmeterProposta&id=<%=((Imovel)imoveis.get(i)).getImvId()%>&cnpj=<%=((Imovel)imoveis.get(i)).getImbCnpj()%>';" value="Submeter proposta" />
                        </td>
                        </tr>
                        <%}%>
        
    </table>
        <br></br> 
    <table align="center">
        <td><input type="button" value="Voltar" onClick="history.go(-1)"></input></td>
    </table>
</form>
                        
<%}%>

<%@include file="../_footer.jsp"%>